// Dacris Benchmarks 6.0
// Codename 'Lyon'
// **
// Plugin SDK
// **
// BmarkPlugins.h
// Defines data structures and functions used by plugins.
// References Codename 'Mercury' interfaces.
// **
// Copyright (C) 2016 Dacris Software Inc. All Rights Reserved.
//
#include "PluginDecl.h"

#define MAX_PLUGINS		80
#define MAX_BASELINES	10
#define MAX_TITLE		40
#define MAX_UNIT		16
#define MAX_DESC		200
#define KEY_LENGTH		20

#define SETTINGS_FILE	"Settings.dat"
#define RESULTS_FILE	"Results.blx"

typedef struct
{
	char lpszTitle[MAX_TITLE];
	int iOrdinal;
	int cbTitle;
} BmarkNav;

typedef struct
{
	int iMajor;
	int iMinor;
} BmarkVer;

typedef struct
{
	int result;
	char unit[MAX_UNIT];
	char title[MAX_TITLE];
} BmarkResult;

typedef struct
{
	BmarkVer version;
	BmarkResult results[MAX_PLUGINS];
	char description[MAX_DESC];
	int nResults;
} BmarkBaseline;

typedef struct
{
	int cbFilenameSize;
	char szFilename[MAX_PATH];
} BmarkBaselineFile;

typedef struct
{
	HMODULE hInst;
	BmarkNav nav;
} BmarkPlugin;

typedef struct
{
	BmarkVer version;
	int iTestDuration;
	int iNumPasses;
	char cDriveLetter;
	int iDefaultBaseline;
	int nBaselineFiles;
	BmarkBaselineFile baselineFiles[MAX_BASELINES];
	char activationKey[KEY_LENGTH];
} BmarkSettings;

typedef struct
{
	PluginData appData;
	BOOL isTestRunning;
	HINSTANCE hInst;
	HWND hStartupDlg;
	HWND hProgressDlg;
	HWND hWebWnd;
	HWND hMainWnd;
	BmarkVer version;
	BmarkSettings settings;
	BmarkPlugin plugins[MAX_PLUGINS];
	BmarkBaseline currentBaseline;
	BmarkBaseline referenceBaseline;
	int nPlugins;
	int navCount;
} BmarkApp;

// Application messages
#define BMARK_REG_NAV			1	// Registers a navigation item
#define BMARK_SHOW_PROGRESS		2	// Shows progress window
#define BMARK_HIDE_PROGRESS		3	// Destroys the progress window
#define BMARK_SET_PROGRESS		4	// Sets progress bar value in progress window
#define BMARK_SET_RESULT		5	// Sets result data in current baseline
#define BMARK_REG_RESULT		6	// Registers a result in current baseline
#define BMARK_NAV_WELCOME		7	// Shows welcome HTML
#define BMARK_NAV_RESULTS		8	// Shows results HTML
#define BMARK_NAV_SYSINFO		9	// Shows system information HTML

// Plugin ordinals
#define BMARK_ATTACH		0	// On attach application
#define BMARK_EXEC			1	// On navigate to item
#define BMARK_SETUP			2	// After registering navigation item
#define BMARK_EXIT			3	// Just before detaching
#define BMARK_CANCEL_TEST	4	// When Cancel is pressed